home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
makmenu2.zip
/
MAKMENU2.DOC
< prev
next >
Wrap
Text File
|
1989-08-09
|
5KB
|
123 lines
MAKMENU2 - A QB4.X BAR MENU FUNCTION
William Baer
Albuquerque, NM
August, 1989
I. INTRODUCTION
MAKMENU2 is a QuickBasic 4.x function to create a vertical
bar menu, make a choice of the options displayed on the menu and
then return the value of the position of the moving bar (1 to N)
to the calling program. This function is a modification of one
which I downloaded from a BBS sometime last year, and I cannot find
the original ZIP file to give credit to the author. I have made
some simplifications to his original routine and added some bells
and whistles to it. In any event, since I didn't do all the hard
work, the function is freeware and you are welcome to use it as you
see fit.
II. FUNCTION DESCRIPTION
A. Function Call
MAKMENU2 is called by the following statement.
Option%=Makmenu2%(Choozit$(),NumofChoices%,LeftCol%,Row%,_
fg%,bg%,fgl%,hfg%,hbg%)
B. Description of Variables
Choozit$() - A string array of the descriptions of the
options to be executed. The number of these variables
must be <= 23.
NumofChoices% - An integer variable giving the number of
options described by Choozit$. Its value must be <= 23
and >= 2.
LeftCol% - An integer variable specifying the column in
which to start the display of option descriptions.
Row% - An integer variable specifying the row on which to
start the display of option descriptions.
fg% - An integer variable specifying the foreground color
used to display the option descriptions.
bg% - An integer variable specifying the background color
used to display the option descriptions.
fgl% - An integer variable specifying the foreground
color used to display the first letter of each option
description and the sequence number of each option if the
number of options is <=10.
-2-
II.B. (Cont'd)
hfg% - An integer variable specifying the foreground
color of the highlight bar used to pick an option.
bfg% - An integer variable specifying the background
color of the highlight bar used to pick an option.
III. FUNCTION OPERATION
When MakMenu2 is called, a check is made to ensure that
the number of options is >=2 and <=23, and that the row
and column at which the option descriptions start will
allow the options to be displayed on the screen without
scrolling, etc. If errors are found then the function is
exited without any error flag being set.
If the number of option choices is <= 10, then the
option descriptions have a sequence number (1,2,3--0)
inserted before each description. In this case, movement
of the option selection bar can be made by hitting the
the number keys, the first letter of each option or by
using the Up/Down, PgUp, PgDn, Home or End keys.
If the number of option choices is >10, the no sequence
numbers are available to make a choice.
Obviously each option description must have a different
starting character. If two options start with the same
character, then using that character to pick an option
will only allow the first of these options to be picked.
Choosing an option by specifying the first character is
done by sorting an array of these first characters which
are extracted from the option descriptions. I have
included a simple string sort routine, but you can
replace it with any other one that pleases you.
If an illegal key is struck, the function beeps and the
option choice bar remains at its current location.
IV. MAKMENU2 DEMO PROGRAM
I have included a very simple example named TESTMENU of
the use of MAKMENU2. Both the QBasic source and the
compiled program are contained in the ZIP file. In real
use, MAKMENU2 should be combined with your favorite
QBasic window routines to make things look elegant!
V. MISCELLANEOUS
If you have any questions, you can leave a message at one
of the BBS' listed below.
Channel 1 (617)-354-8873
Microsellar (201)-239-1346
Computer Connection (202)-547-2008
PC Network (505)-821-5341